package com.gitee.dynamicproxy.jdk;

import com.gitee.dynamicproxy.service.OrderService;
import com.gitee.dynamicproxy.service.impl.OrderServiceImpl;

import java.io.IOException;

/**
 * @author ming.yan-1
 * @version V1.0
 * @Title com.gitee.dynamicproxy
 * @Description
 * @date 2018/9/11  下午6:36
 */
public class Demo {

    public static void main(String[] args) throws IOException {
        System.getProperties().put("sun.misc.ProxyGenerator.saveGeneratedFiles", "true");
        jdkDynamicProxy();
    }

    public static void jdkDynamicProxy() throws IOException {
        OrderService orderService = new OrderServiceImpl();
        OrderService dynamicOrderService = (OrderService) new JdkDemo().instance(orderService);
        OrderService dynamicOrderService1 = (OrderService) new JdkDemo().instance(orderService);
        System.out.println("开始");
        dynamicOrderService.creatOrder("123456");
        System.out.println("结束");
    }
}
